<?php
	$this->headScript()->appendFile($this->dirJs.'/msdropdown/msdropdown/jquery.dd.js');
	$this->headLink()->appendStylesheet($this->dirJs.'/msdropdown/msdropdown/dd.css');
	$this->headLink()->appendStylesheet($this->dirCss.'/mainstyle.css');
	$this->headLink()->appendStylesheet($this->dirCss.'/jobpreview.css');

	$this->headScript()->appendFile($this->dirJs.'/jdpicker/jquery.jdpicker.js');
	$this->headLink()->appendStylesheet($this->dirJs.'/jdpicker/jdpicker.css');
?>
<?php echo $this->render('common/header.phtml'); ?>
<?php echo $this->render('common/dialog.phtml'); ?>

<div class="deleteMessages"></div>
	<div id="main-content-wrapper">
    
    	<div id="main-content-bg">
            <div id="logo-frame"><br />
                <div id="logo">
                    <div style="line-height: 196px;">
                        <img alt="logo" style="vertical-align:middle" src="<?php echo $this->baseUrl($this->jobInfo['logo']); ?>">
                    </div>
                    <!-- <p><a href="javascript:">CHANGE LOGO</a></p> -->
                    ( <a href="javascript:">Display</a> | <a href="javascript:">Undisplay</a> )
                </div>
            </div>
            
            <div id="preview-info">
                
                <h1>COMPANY INFORMATION <a href="javascript:" class="job-prev-edit">( Edit )</a></h1>
                <div class="clear_row"></div>
                <span class="column-name">Company name:</span>		<span class="content bold"><?php echo $this->employerInfo['companyname']; ?></span>
                
                <span class="column-name">Size:</span>				<span class="content bold"><?php echo $this->employerInfo['companySize']; ?> </span>
                <span class="column-name">Company address:</span>	<span class="content bold"><?php echo $this->employerInfo['companyaddress']; ?></span>
                <span class="column-name">Company profile</span>	<span class="content"><?php echo $this->employerInfo['companyprofile']; ?></span>
                
                <h1>JOB INFORMATION <a href="javascript:" class="job-prev-edit"> ( Edit )</a></h1>           
                <span class="column-name">Job Title</span>			<span class="content bold"><?php echo $this->jobInfo['title']; ?></span>
                <span class="column-name">Job Level</span>			<span class="content bold"><?php echo $this->jobInfo['level']; ?></span>
                <span class="column-name">Salary</span>				<span class="content bold"><?php echo $this->jobInfo['salary']; ?> per month</span>
                <span class="column-name">Work place</span>			<span class="content bold"><?php echo $this->jobInfo['province']; ?></span>
                <span class="column-name">Job Category</span>		<span class="content bold"><?php echo $this->jobInfo['category']; ?></span>
                <span class="column-name">Job Description</span>	<span class="content"><?php echo $this->jobInfo['description']; ?></span>
    
    
                <span class="column-name">Job Requirement</span>	<span class="content"><?php echo $this->jobInfo['requirement']; ?></span>
    
    
                <span class="column-name">Dealine</span>			<span class="content bold"><?php echo $this->jobInfo['deadline']; ?></span>
                <?php if(!empty($this->jobInfo['language'])) {?>
                	<span class="column-name">Preferred Language For Applications</span>	<span class="content bold"><?php echo $this->jobInfo['language']; ?></span>
                <?php }?>
                
                <h1>CONTACT INFORMATION <span class="job-prev-edit"> <a href="javascript:" class="job-prev-edit">( Edit )</a></h1>
                <span class="column-name">Contact person</span>			<span class="content bold"><?php echo $this->jobInfo['contact_person_name']; ?></span>
                <span class="column-name">Email for applications</span>	<span class="content bold"><?php echo $this->jobInfo['email_for_application']; ?></span>
            </div>
            
            <div id="job-prev-command">
            	<a href="javascript:" class="postjob" > </a>
                <a href="javascript:" class="cancel"> </a>
                <a href="javascript:" class="save"> </a>
            </div><!-- END #commnad -->
    	</div><!-- END #main-content-bg --> 
	</div><!-- END #main-content-wrapper -->
   
    <?php 
	    $current = getdate();
	    $current_date = $current['mday'].'/'.$current['mon'].'/'.$current['year'];
    ?>
	<script type="text/javascript">
  
		$(document).ready(function(e) {
			//Button Postjob
            $('.postjob').click(function(){		
				var jobId = '&jobId='+<?php echo $this->jobId ?>+'&command=2';
				$.ajax({
					type: "POST",
					data: jobId,
					url: "<?php echo $this->baseUrl('employer/index/postjob/');?>",					
					dataType: "json",
					beforeSend: function (){
						
					},
					success: function(response){						
						if(response.result.code == 'OK'){
							$( ".deleteMessages" ).html(response.result.message).dialog({
								resizable: false,
								width:400,
								height:145,
								modal: true,
								buttons: {
									OK: function(){
										window.location = "<?php echo $this->baseUrl('employer/manage');?>";						 
									}/*,
									Cancel: function() {
										$(this).dialog( "close" );
									}
									/**/
								}
							});			
						}
						else{
							$( ".deleteMessages" ).html(response.result.message).dialog({
								resizable: false,
								width:400,
								height:145,
								modal: true,
								buttons: {
									OK: function(){
										$(this).dialog( "close" );				 
									}
								}
							});		
						}
					}					
				});
            	
			});
			
			
			//Button save
			$('.save').click(function(){		
				var jobId = '&jobId='+<?php echo $this->jobId ?>+'&command=1';	
				$.ajax({
					type: "POST",
					data: jobId,
					url: "<?php echo $this->baseUrl('employer/index/postjob/');?>",					
					dataType: "json",
					beforeSend: function (){
						
					},
					success: function(response){						
						if(response.result.code == 'OK'){							
							$('#dialog-wrapper').css('display','block');
							$('html, body').animate({scrollTop:0},500);	
							//window.location = "<?php //echo $this->baseUrl('employer/index');?>";						
						}
						else{
							$( ".deleteMessages" ).html(response.result.message).dialog({
								resizable: false,
								width:400,
								height:145,
								modal: true,
								buttons: {
									OK: function(){
										$(this).dialog( "close" );				 
									}
								}
							});			
						}
					}					
				});
			});
        });
	</script>
<?php echo $this->render('common/footer.phtml'); ?>